package com.zs.blog.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zs.blog.typehandler.JsonFiledTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @Title: Menu
 * @Author zs
 * @Package com.zs.blog.model.entity
 * @Date 2024/10/11 23:46
 * @description: 菜单表
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("um_menu")
public class Menu {
    @Schema(description = "菜单ID")
    @TableId(type = IdType.AUTO)
    public Long id;

    @Schema(description = "路由地址")
    public String routePath;

    @Schema(description = "路由名称，路由的唯一标识")
    public String routeName;

    @Schema(description = "组件")
    public String component;

    @Schema(description = "重定向地址")
    public String redirectUrl;

    @Schema(description = "路由元数据，包括菜单名称、菜单 icon、角色等内容")
//    @TableField(typeHandler = JsonFiledTypeHandler.class)
    public String metaData;

    @Schema(description = "菜单名")
    public String menuName;

    @Schema(description = "菜单 icon，默认为 null")
    public String menuIcon;

    @Schema(description = "父 id，默认为 0,0表示最顶层的菜单")
    public Long parentId;

    @Schema(description = "排序")
    public Integer sort;

    @Schema(description = "是否隐藏[0:显示，1:隐藏 ]")
    public Integer isHidden;

    @Schema(description = "是否删除[0:否，1:是]")
    public Integer isDeleted;

    @Schema(description = "类型 [0:目录，1:菜单 ]")
    public Integer type;

    @Schema(description = "创建时间")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd hh-mm-ss", shape = JsonFormat.Shape.STRING)
    @TableField(fill = FieldFill.INSERT)
    public LocalDateTime createTime;

    @Schema(description = "更新时间")
    @JsonFormat(timezone = "GMT+8", locale = "zh", pattern = "yyyy-MM-dd hh:mm:ss", shape = JsonFormat.Shape.STRING)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    public LocalDateTime updateTime;
}
